﻿using System;
using System.Collections.Generic;
using System.Text;
using ECommerce.DAL;
using System.Data.SqlClient;
using System.Data;
namespace Entity
{
    [System.ComponentModel.DataObject]
    public class TblSalesPersonExtended:TblSalesPerson
    {
        public static CustomCollection<TblSalesPerson> GetSalesPersonByUserName(string UserName, string Password)
        {
            SqlCommand sqlCmd = new SqlCommand();
            AddParameterToSqlCmd(sqlCmd, "@SPUserName", SqlDbType.NVarChar, 500, ParameterDirection.Input, UserName);
            AddParameterToSqlCmd(sqlCmd, "@SPPassword", SqlDbType.NVarChar, 500, ParameterDirection.Input, Password);
            SetCommandType(sqlCmd, CommandType.StoredProcedure, SP_TBL_SALES_PERSON_GET_TBLUSER_BY_USERNAME_PASSWORD);
            GenerateCollectionFromReader test = new GenerateCollectionFromReader(GenerateTblSalesPersonCollectionFromReader);
            CustomCollection<TblSalesPerson> objCollection = ((CustomCollection<TblSalesPerson>)ExecuteReaderCmd(sqlCmd, test));
            return objCollection;
        }
        public static CustomCollection<TblSalesPerson> GetSalesPersonByUserName(string UserName)
        {
            SqlCommand sqlCmd = new SqlCommand();
            AddParameterToSqlCmd(sqlCmd, "@SPUserName", SqlDbType.NVarChar, 500, ParameterDirection.Input, UserName);
            SetCommandType(sqlCmd, CommandType.StoredProcedure, SP_TBL_SALES_PERSON_GET_TBLUSER_BY_USERNAME);
            GenerateCollectionFromReader test = new GenerateCollectionFromReader(GenerateTblSalesPersonCollectionFromReader);
            CustomCollection<TblSalesPerson> objCollection = ((CustomCollection<TblSalesPerson>)ExecuteReaderCmd(sqlCmd, test));
            return objCollection;
        }

        private const string SP_TBL_SALES_PERSON_GET_TBLUSER_BY_USERNAME_PASSWORD = "sp_TblSalesPerson_GetTblSalesPersonByUserNamePassword";
        private const string SP_TBL_SALES_PERSON_GET_TBLUSER_BY_USERNAME = "sp_TblSalesPerson_GetTblSalesPersonByUserName";
    }
}
